using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Bornander.UI.ListItems
{
    public partial class Album : UserControl, IExtendedListItem
    {
        private event EventHandler Play;

        public Album()
        {
            InitializeComponent();
            

            SelectedChanged(false);
        }

        public Album(string title, string artist, string releaseYear, Image albumArt)
        {
            InitializeComponent();

            Title = title;
            Artist = artist;
            ReleaseYear = releaseYear;
            AlbumArt = albumArt;

            SelectedChanged(false);
        }

        public string Title
        {
            get { return title.Text; }
            set { title.Text = value; }
        }

        public string Artist
        {
            get { return artist.Text; }
            set { artist.Text = value; }
        }

        public string ReleaseYear
        {
            get { return releaseYear.Text; }
            set { releaseYear.Text = value; }
        }

        public Image AlbumArt
        {
            get { return albumArtPicture.Image; }
            set { albumArtPicture.Image = value; }
        }

        #region IExtendedListItem Members

        public void SelectedChanged(bool isSelected)
        {
            if (isSelected)
            {
                Height = 72;
                albumArtPicture.Size = new Size(64, 64);
                artist.Visible = true;
                releaseYear.Visible = true;
            }
            else
            {
                Height = 40;
                albumArtPicture.Size = new Size(32, 32);
                artist.Visible = false;
                releaseYear.Visible = false;
            }
        }

        public void PositionChanged(int index)
        {
            if ((index & 1) == 0)
                BackColor = SystemColors.Control;
            else
                BackColor = SystemColors.ControlLight;
        }

        #endregion

        private void playButton_Click(object sender, EventArgs e)
        {
            // Do nada for now
            MessageBox.Show(this.Title);

        }
    }
}
